import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/sys/login',
    method: 'POST',
    data
  })
}

export function getUserInfo() {
  return request({
    url: '/sys/profile',
    method: 'POST'
  })
}

export function logout() {
  return request()
}
/**
 * 根据id获取用户信息
 * @param {*} id
 * @returns
 */
export function getUserInfoById(id) {
  return request({
    url: '/sys/user/' + id
  })
}

export function updateUserInfoById(data) {
  return request({
    url: '/sys/user/' + data.id,
    method: 'put',
    data
  })
}

// /employees/{id}/personalInfo

// Method： PUT
/**
 * 获取员工个人信息
 * @param {} id
 * @returns
 */
export function getUserBaseInfoById(id) {
  return request({
    url: `/employees/${id}/personalInfo`,
    method: 'get'
  })
}

export function saveUserInfoById(data) {
  return request({
    url: `/employees/${data.id}/personalInfo`,
    method: 'put',
    data
  })
}
